package com.ucap.weking.guangan.fragments;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;

import com.ucap.weking.guangan.R;
import com.ucap.weking.guangan.adapter.ViewPagerAdapter;
import com.ucap.weking.guangan.base.BaseFragment;
import com.ucap.weking.guangan.fragments.fragmentContent.LiveOnlineFragment;
import com.ucap.weking.guangan.fragments.fragmentContent.Phone12345Fragment;
import com.ucap.weking.guangan.fragments.publicFragment.WebFragment;

import java.util.ArrayList;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by weking on 2017/10/17.
 */

public class HomeContent3 extends BaseFragment {
    @InjectView(R.id.tab)
    TabLayout tabLayout;
    @InjectView(R.id.vp_content)
    ViewPager vpContent;

    @Override
    public void setData() {
        ArrayList<Fragment> mContent = new ArrayList<>();
        WebFragment webFragment1 = new WebFragment();
        webFragment1.setUri("http://mail.guang-an.gov.cn:8050/login");
        mContent.add(webFragment1);
        mContent.add(new Phone12345Fragment());
        mContent.add(new LiveOnlineFragment());
        WebFragment webFragment2 = new WebFragment();
        webFragment2.setUri("http://www.guang-an.gov.cn/robot/res/index.html?confid=4ACC41ED910B9FFCAA2F702CE0DBB179");
        mContent.add(webFragment2);
        String[] title = {"市长信箱", "12345", "在线访谈", "智能问答"};
        tabLayout.setupWithViewPager(vpContent);
        vpContent.setAdapter(new ViewPagerAdapter(getActivity().getSupportFragmentManager(), mContent, title));
    }

    @Override
    public void intiView() {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.frgament_home_content1, null);
        flContent.addView(view);
        ButterKnife.inject(this, view);
    }
}
